<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<style type="text/css">
#ciCategoryTree {
	
}

#ciCategoryTree li {
	float: left; padding: 5px
}

#ciCategoryTree li .switch {
	display: none
}
</style>
<script type="text/javascript">
	function ciCategoryTree_onNodeClick(event, treeId, treeNode) {
		if (treeNode.id != "") {
			ciGrid.search({
				"field" : "conf_category_id",
				"op" : "eq",
				"data" : treeNode.id
			});
		} else {

			ciGrid.search({
				"field" : "conf_category_id",
				"op" : "ne",
				"data" : '1'
			});
		}

	}

	function ciGridOndbClick(rowid) {

		var rowData = ciGrid.getRowData();
		window.parent.setCustomerCiValue(rowData.id, rowData.name,rowData);

	}

	function getSelectRow(fun) {
		var rowData = ciGrid.getRowData();
		if (rowData)
			window.parent.setCustomerCiValue(rowData.id, rowData.name,rowData);
		else {
			alert("请选择一条服务资产！");
		}
	}

	function maintainerDate(cellvalue, options, rowObject) {

		return (rowObject.maintainer_start_date || "") + "~" + (rowObject.maintainer_end_date || "");
	}
</script>


<div class="box no-border">
	<isperp:tree id="ciCategoryTree" modal="false">
		<isperp:async enable="true"
			url="configuration/ci/getCustomerCiCategoryMenu?customerId=${customerId}">
		</isperp:async>
		<isperp:callback onClick="ciCategoryTree_onNodeClick">
		</isperp:callback>
	</isperp:tree>
	<isperp:grid gridId="ciGrid" cusViewUrl="configuration/ci/ciResumeView"
		ondbClickRowEvent="ciGridOndbClick(rowid)"
		url="configuration/ci/listCustomerCi?customerId=${customerId}">
		<jsp:attribute name="searchbar">
		<table class="form-table">
			<tbody>
				<tr>
					<td class="td1">编号：</td>
					<td class="td2"><input type="text" field="code" op="cn">
					</td>
					<td class="td1">名称：</td>
					<td class="td2"><input type="text" field="name" op="cn">
					</td>
				</tr>
			</tbody>
		</table>
		</jsp:attribute>
		<jsp:body>
		<isperp:column name="id" title="id" hidden="true"></isperp:column>
		<isperp:column name="code" title="编号" width="80">
		</isperp:column>
		<isperp:column name="name" title="名称" width="80">
		</isperp:column>
		<isperp:column name="asset_code" title="序列号" width="80">
		</isperp:column>
		
		
		<isperp:column name="conf_category_name" title="维保日期" width="150"
				formatter="return maintainerDate(cellvalue,options,rowObject)"
				isFormatterFun="true"></isperp:column>
		<isperp:column name="maintainer_start_date" title="分类" width="80" hidden="true">
		</isperp:column>
		<isperp:column name="maintainer_end_date" title="维保日期" width="10"
				hidden="true"></isperp:column>
		<isperp:column name="status" title="状态" width="40">
		</isperp:column>
 		</jsp:body>
	</isperp:grid>


	<script type="text/javascript">
		function formatCiName(rowObject) {
			return "<a href=\"javascript:isperp.openDialog({contentUrl:'configuration/ci/ciResumeView?id=" + rowObject.id + "'});\">" + rowObject.name + "</a>";
		}
	</script>

</div>
